source("cces_recodes.R")

imm.model.step1 <- lmer(imm.scale ~ fb_d + (1|lookupzip), data = df.m, 
                        subset = imm == 1, nAGQ = 0)
imm.model.step2 <- lmer(imm.scale ~ fb_d + fb_lag + (1|lookupzip), data = df.m, 
                        subset = imm == 1, nAGQ = 0)
imm.model.step3 <- lmer(imm.scale ~ fb_d + fb_lag + fb_lag*fb_d + (1|lookupzip), data = df.m, 
                        subset = imm == 1, nAGQ = 0)
imm.model.step4 <- lmer(imm.scale ~ fb_d + fb_lag + fb_lag*fb_d + ideology + (1|lookupzip), data = df.m, 
                        subset = imm == 1, nAGQ = 0)

imm.model.full <- lmer(imm.scale ~ fb_d + fb_lag + fb_lag*fb_d + ideology + gender + 
                         age + educ + faminc + pid7 + own + hisp + asian + lived + pcthisp_01 + 
                         pctasian_01 + pctunemp_01 + medianhsvl_01 + (1|lookupzip), data = df.m, 
                       subset = imm == 1, nAGQ = 0)

stargazer(imm.model.step1, imm.model.step2, imm.model.step3, imm.model.step4, imm.model.full, covariate.labels = c("Delta Immigrant", "Surrounding Composition", "Ideology", "Gender", "Age", "Education", "Income", "Partisanship", "Homeownership", "Hispanic", "Asian", "Tenure", "Pct. Hispanic", "Pct. Asian", "Pct. Unemployed", "Median Housing Value", "Delta Immigrant x Surrounding Composition", "Intercept"), no.space = TRUE, digits = 2, single.row = TRUE)

trump.model.step1 <- glmer(trump ~ fb_d + (1|lookupzip), data = df.m,
                           subset = imm == 1, family = binomial(link="logit"), nAGQ = 0)

trump.model.step2 <- glmer(trump ~ fb_d + fb_lag + (1|lookupzip), data = df.m, 
                           subset = imm == 1, family = binomial(link="logit"), nAGQ = 0)

trump.model.step3 <- glmer(trump ~ fb_d + fb_lag + fb_lag*fb_d + (1|lookupzip), data = df.m, 
                           subset = imm == 1, family = binomial(link="logit"), nAGQ = 0)

trump.model.step4 <- glmer(trump ~ fb_d + fb_lag + fb_lag*fb_d + pid7 + (1|lookupzip), data = df.m, 
                           subset = imm == 1, family = binomial(link="logit"), nAGQ = 0)

trump.model.full <- glmer(trump ~ fb_d + fb_lag + fb_lag*fb_d + ideology + gender + 
                            age + educ + faminc + pid7 + own + hisp + asian + lived + pcthisp_01 + 
                            pctasian_01 + pctunemp_01 + medianhsvl_01 + (1|lookupzip), data = df.m, 
                          subset = imm == 1, family = binomial(link="logit"), nAGQ = 0)

stargazer(trump.model.step1, trump.model.step2, trump.model.step3, trump.model.step4, trump.model.full, covariate.labels = c("Delta Immigrant", "Surrounding Composition", "Ideology", "Gender", "Age", "Education", "Income", "Partisanship", "Homeownership", "Hispanic", "Asian", "Tenure", "Pct. Hispanic", "Pct. Asian", "Pct. Unemployed", "Median Housing Value", "Delta Immigrant x Surrounding Composition", "Intercept"), single.row = TRUE, no.space = TRUE, digits = 2)
